package com.jasmine.bjstkserver.server.article.log.draftlog;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;


/**
 * 异步监听日志事件
 * @author jasmineXz
 */
@Component
public class DraftLogListener {

	@Autowired
	private DraftLogService draftLogService;

	/**
	 * 记录文章修改日志
	 * @param event 事件
	 */
	@Async
	@EventListener(DraftLogEvent.class)
	public void saveSysLog(DraftLogEvent event) {
		DraftLogEntity draftLog = (DraftLogEntity) event.getSource();
		draftLogService.insert(draftLog);
	}
}
